package com.sgb.kjwl.view.ui.adapter.packers;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.sgb.kjwl.R;
import com.sgb.kjwl.utils.NumberConstant;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter2;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;
import java.util.Locale;

/**
*@author 1678258207035258
*@date 2020/8/15
*description:
*/
public class FindPeoplePicAdapter extends BaseRecycleAdapter2<String> {
    int totalSize;
    public FindPeoplePicAdapter(Context context, List<String> data) {
        super(context, R.layout.item_people_pic, data);
    }

    public int getTotalSize() {
        return totalSize;
    }

    public void setTotalSize(int totalSize) {
        this.totalSize = totalSize;
    }

    @Override
    public void convert(ItemViewHolder holder, String entity, int position) {
        ImageView iv = holder.itemView.findViewById(R.id.iv_view);

        TextView tvNum=holder.itemView.findViewById(R.id.tv_num);
        Glide.with(context).load(entity).into(iv);
        tvNum.setText(String.format(Locale.CHINA,"%d图",totalSize));
        RelativeLayout rlCover =holder.itemView.findViewById(R.id.rl_cover);
        if(datas.size()== NumberConstant.NUMBER_THREE &&position==datas.size()-1){
            rlCover .setVisibility(View.VISIBLE);
        }else{
            rlCover .setVisibility(View.GONE);
        }
    }
}
